package il.ac.tau.cg.ex5.lighting;

import il.ac.tau.cg.ex5.config.SceneConstants;

import javax.media.opengl.GL2;
import javax.media.opengl.fixedfunc.GLLightingFunc;

public class PointLighter extends Lighter
{
	private static final String NAME = "Point light";
	
	private static final float[] POSITION = {
			SceneConstants.POINT_LIGHT_X,
			SceneConstants.POINT_LIGHT_Y,
			SceneConstants.POINT_LIGHT_Z, 1.0f };
	
	private static final float[] AMBIENT = { 0.2f, 0.2f, 0.2f, 1.0f };
	private static final float[] DIFFUSE = { 1.0f, 1.0f, 1.0f, 1.0f };
	
	@Override
	protected void internalSetLighting(GL2 gl)
	{
		gl.glEnable(GLLightingFunc.GL_LIGHT0);
		
		gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_AMBIENT, AMBIENT, 0);
		gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_DIFFUSE, DIFFUSE, 0);
		gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, POSITION, 0);
	}
	
	@Override
	public String getName()
	{
		return NAME;
	}
}
